package springbootyx.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import springbootyx.service.ICommentService;
import springbootyx.entity.Comment;


@ResponseBody
@Component
@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired


    private ICommentService commentService;

    @RequestMapping("/addComment")
    public String addComment(Comment comment) {
        commentService.addComment(comment);
        return "redirect:/article/detail?id=" + comment.getFid();
    }


}
